package com.bee.tlweb.service;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.bee.tlweb.model.Email;

public class EmailService {
	static Map<Long,Email> map = new HashMap<Long,Email>();
	static {
		Email email1 = new Email();
		email1.setEmailId(1);
		email1.setCc(new String[]{"leader@163.com"});
		email1.setFrom(new String[]{"lucy@163.com","xiandafu@126.com"});
		email1.setTitle("收到一封邮件");
		email1.setContent("Hi,你的朋友给你了一封邮件");
		email1.setTo(new String[]{"xiandafu@126.com"});
		email1.setRead(false);
		email1.setSendTime(new Date());
		
		Email email2 = new Email();
		email1.setEmailId(2);
		email2.setCc(new String[]{"leader@163.com"});
		email2.setFrom(new String[]{"lucy@163.com","xiandafu@126.com"});
		email2.setTitle("收到一封邮件");
		email2.setContent("Hi,你的朋友给你了一封邮件");
		email2.setTo(new String[]{"xiandafu@126.com"});
		email2.setRead(false);
		email2.setSendTime(new Date());
		
		Email email3 = new Email();
		email1.setEmailId(3);
		email3.setCc(new String[]{"leader@163.com"});
		email3.setFrom(new String[]{"lucy@163.com","xiandafu@126.com"});
		email3.setTitle("XXX广告");
		email3.setContent("Hi,你的朋友给你了一封邮件,");
		email3.setTo(new String[]{"xiandafu@126.com"});
		email3.setRead(true);
		email3.setSendTime(new Date());
		
		map.put(email1.getEmailId(), email1);
		map.put(email2.getEmailId(), email2);
		map.put(email3.getEmailId(), email3);
		
		
		
	}
	
	public List<Email> getLatestEmail(long userId){
		return new ArrayList<Email>(map.values());
	}
	
	public Email getEmailDetail(long emailId){
		return map.get(emailId);
	}
	
	public void sendEmail(Email email){
		return ;
	}
}
